package tmlxq.team.servera.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import tmlxq.team.servera.server.SendService;

/**
 * @auther zhoupan
 * @date 2020/4/29 22:08
 * @info
 */
@RestController
@RequestMapping
public class KafkaApi {


    @Autowired
    SendService sendService;


    @GetMapping("/send/{name}")
    public String send(@PathVariable String name) {
        // 创建消息
//        Message msg = MessageBuilder.withPayload("Hello World".getBytes()).build();
//        // 发送消息
//        sendService.sendOrder().send(msg);
//        this.source.output()
        sendService.sendMsg(name);
        return name;
    }
}
